<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Insert title here</title>
<link href="/resource/css/bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="/resource/js/jquery-3.2.1.js"></script>
<script type="text/javascript" src="/resource/js/bootstrap.js"></script>
</head>
<body>

	<div>
		<h1>深圳******人才房屋配租表</h1>
		总套数：${company.total }. 其中一居 ${company.type1 } , 其中二居 ${company.type2 },
		其中三居 ${company.type3 }

	</div>
	<hr>

	<div>

		类别名称：
		<c:forEach items="${classifies}" var="classify">
			<a href="/list?cname=${classify.name}">${classify.name}</a>

		</c:forEach>

		<a href="/list">全部</a>

		<div style="float: right">
			套数排序：<a href="/list?orderMethod=asc">升序 </a> <a
				href="/list?orderMethod=desc">降序 </a> <a href="/list">取消 </a>

		</div>

	</div>

	<table class="table">
		<tr>
			<td>序号</td>
			<td>申请单位</td>
			<td>单位类型</td>
			<td>一居室</td>
			<td>二居室</td>
			<td>三居室</td>
			<td>总套数</td>
			<td>操作</td>

		</tr>
		<c:forEach items="${info.list}" var="company">


			<tr>
				<td>${company.id }</td>
				<td>${company.name }</td>
				<td>${company.cnames }</td>
				<td>${company.type1}</td>
				<td>${company.type2 }</td>
				<td>${company.type3}</td>
				<td>${company.total}</td>
				<td>修改|
					<button type="button" onclick="deleteCompany(${company.id})">
						删除</button>
				</td>


			</tr>

		</c:forEach>

	</table>

	<div>
		<jsp:include page="/WEB-INF/view/pages.jsp"></jsp:include>
	</div>

</body>

<script type="text/javascript">
//删除公司
function deleteCompany(id){
	var ret =confirm("确定删除");
	if(ret){
		$.post("/deleteCompany",{id:id},function(flag){
			if(flag){
				alert( "删除成功");
			   location.href="/list"
			}else{
				alert("删除失败")
			}
		})
	}
}


function goPage(pageNum){
	var cname='${companyVO.cname}';//获取查询条件
	var orderMethod='${companyVO.orderMethod}';//获取查询条件
	location.href="/list?pageNum="+pageNum+"&cname="+cname+"&orderMethod="+orderMethod;
}

</script>
</html>